Skip to content

HHH-17404 : Add support of reading/writing from/to special source/target in FormatMapper #9629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 81 commits into from
Jun 17, 2025

Conversation

ejannett
Copy link
Contributor

@ejannett ejannett commented Jan 16, 2025

This PR brings code changes needed by HHH-17404.
This adds the support of Oracle OSON (JSON binary format) to Hibernate allowing improved performance over
JSON to String conversions.

Two new types are defined
org.hibernate.dialect.OracleOsonJacksonJdbcType
and
org.hibernate.dialect.OracleOsonJacksonArrayJdbcType

The support of OSON is enabled by adding the Oracle JDBC extension jar as runtime dependency.
New capabilities in FormatMapper interface have been added to support the serialization and deserialization from different sources (OSON bytes, JSON String representation ,etc..).

The entire hibernate-core test suite has been successfully run with and without the enablement of OSON.
This has been done by adding/removing the Oracle JDBC extension in hibernate-testing project build file

runtimeOnly ('com.oracle.database.jdbc:ojdbc-provider-jackson-oson:1.0.4')
  {
            exclude group: 'com.oracle.database.jdbc', module: 'ojdbc8'
  }

The hibernate.dialect.oracle.oson_format_disabled new dialect settings has been also tested. With that
setting set to true in hibernate.properties file the extension is not used.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


https://hibernate.atlassian.net/browse/HHH-17404
https://hibernate.atlassian.net/browse/HHH-14707

@hibernate-github-bot
Copy link

hibernate-github-bot bot commented Jan 16, 2025

Thanks for your pull request!

This pull request appears to follow the contribution rules.

› This message was automatically generated.

@ejannett ejannett changed the title Hhh 17404 HHH-17404 : Add support of reading/writing from/to special source/target in FormatMapper Jan 20, 2025
@ejannett ejannett marked this pull request as ready for review March 20, 2025 13:24
@BidyadharM BidyadharM force-pushed the HHH-17404 branch 3 times, most recently from 7f6496b to c964ad8 Compare March 27, 2025 09:03
Copy link
Member

@mbellade mbellade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All major concerns should be addressed, CI is green except for oracle_atps that is failing for unrelated reasons. The PR look good to me, thanks @ejannett and @BidyadharM!

@beikov beikov added the 7.1 label May 15, 2025
@yrodiere
Copy link
Member

yrodiere commented Jun 5, 2025

Hey @ejannett @jeandelavarene , as discussed offline, there is now an AUTHORS.txt file. Could you please rebase, add Oracle to AUTHORS.txt, and remove any change to file headers (if any)?

We'll probably change/remove the headers at some point, but AFAIU this is not absolutely required for your contribution.

Thanks again for your work and your help.

return false;
}

default <T> void writeToTarget(T value, JavaType<T> javaType, Object target, WrapperOptions options) throws IOException {

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'options' is never used.
throw new UnsupportedOperationException( "Unsupportd target type " + target.getClass() );
};

default <T> T readFromSource(JavaType<T> javaType, Object source, WrapperOptions options) throws IOException {

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'options' is never used.
/**
* Starts a new JSON array.
* @return this instance
* @throws IOException an I/O error roccured while starting the object.

Check notice

Code scanning / CodeQL

Javadoc has impossible 'throws' tag Note

Javadoc for startArray claims to throw IOException but this is impossible.
/**
* Ends a new JSON array.
* @return this instance
* @throws IOException an I/O error roccured while starting the object.

Check notice

Code scanning / CodeQL

Javadoc has impossible 'throws' tag Note

Javadoc for endArray claims to throw IOException but this is impossible.
* @param key the element name.
* @return this instance
* @throws IllegalArgumentException key name does not follow JSON specification.
* @throws IOException an I/O error occurred while starting the object.

Check notice

Code scanning / CodeQL

Javadoc has impossible 'throws' tag Note

Javadoc for objectKey claims to throw IOException but this is impossible.
/**
* Adds a new JSON element null value.
* @return this instance
* @throws IOException an I/O error roccured while starting the object.

Check notice

Code scanning / CodeQL

Javadoc has impossible 'throws' tag Note

Javadoc for nullValue claims to throw IOException but this is impossible.
ejannett and others added 28 commits June 17, 2025 16:28
         removed some unchecked cast warning
@beikov beikov merged commit f01bcc0 into hibernate:main Jun 17, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants